import { createRouter, createWebHistory } from 'vue-router'
// import Home from '../views/Home.vue'
import Start from '../views/Start'

// 路由的配置数组
// path: 路由的路径 必须以 /开头
// component: 对应的路由组件
// name: 路由名字
const routes = [
  {
    path: '/',
    name: 'Start',
    component: Start
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import(/* webpackChunkName: "about" */ '../views/Home')
  },
  {
    path: '/about',
    name: 'About',
    // 按需引入
    // 如果没有访问 /about 就不会加载这个组件(节省性能)
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: '/detail',
    name: 'Detail',
    component: () => import(/* webpackChunkName: "about" */ '../views/Detail')
  },
  {
    path: '/life-cycle',
    name: 'LifeCycle',
    component: () => import(/* webpackChunkName: "about" */ '../views/LifeCycle')
  },


]

// 创建路由对象
const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
